<template>
	<view style="background-color: #fff; padding: 20rpx 40rpx;padding-bottom: 100rpx;">
		<u--form :model="form" :borderBottom="true" ref="uForm" labelPosition="top">
			<u-form-item :borderBottom="true" prop="wx_number" label="微信号" labelWidth="200">
				<u-input border="none" v-model="form.wx_number" placeholder="请输入微信号" />
			</u-form-item>
		</u--form>
		<view style="margin-top: 90rpx;">
			<u-button @click="updateWxNumber()" shape="circle" color="linear-gradient(to left, #e44e15, #f4aa56)" >修改微信号</u-button>
		</view>
	</view>
</template>

<script>
	import {updateInfo} from '@/common/user.api.js'
	export default {
		data() {
			return {
				value: '',
				form:{
					wx_number: ''
				},
			}
		},
		onLoad({wx_number}) {
			this.form.wx_number = wx_number
		},
		methods: {
			updateWxNumber(){
				let that = this;
				uni.showLoading({
					title: '正在修改微信号'
				})
				updateInfo({ wx_number: that.form.wx_number}).then(res => {
					uni.$emit('updateUserInfo',{msg:'刷新用户信息'})
					
					uni.hideLoading()
					that.$u.toast('修改成功');
				})
			}
		}
	}
</script>

<style>
	body{
		background-color: #f5f5f5;
	}
</style>
